<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>computed 计算属性</title>
</head>
<body>

<div id="app">

    <p>Now time is: {{ currentTime1() }}</p>
    <p>Now time is: {{ currentTime2 }}</p>

</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue.js!'
        },
        methods: {
            currentTime1: function () {
                return Date.now(); // 返回当前时间戳
            }
        },
        computed: {
            currentTime2: function () {
                return Date.now(); // 返回当前时间戳
            }
        }

    })

</script>

</body>
</html>